﻿/*!	@file	r_input_device_keys.h
	@brief	キー入力
Copyright (c) 2009 Yuya Yamaguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef _R_INPUT_DEVICE_KEYS_H_
#define _R_INPUT_DEVICE_KEYS_H_

#include "r_input_device.h"
namespace r{
	namespace input{

		enum DeviceKeysValue {
			DeviceKeys_A = 0,
			DeviceKeys_B,
			DeviceKeys_C,
			DeviceKeys_D,
			DeviceKeys_E,
			DeviceKeys_F,
			DeviceKeys_G,
			DeviceKeys_H,
			DeviceKeys_I,
			DeviceKeys_J,
			DeviceKeys_K,
			DeviceKeys_L,
			DeviceKeys_M,
			DeviceKeys_N,
			DeviceKeys_O,
			DeviceKeys_P,
			DeviceKeys_Q,
			DeviceKeys_R,
			DeviceKeys_S,
			DeviceKeys_T,
			DeviceKeys_U,
			DeviceKeys_V,
			DeviceKeys_W,
			DeviceKeys_X,
			DeviceKeys_Y,
			DeviceKeys_Z,
			DeviceKeys_Escape,
			DeviceKeys_Enter,
			DeviceKeys_Return,
			DeviceKeys_Tab,
			DeviceKeys_Space,
			DeviceKeys_Del,
			DeviceKeys_BS,
			DeviceKeys_0,
			DeviceKeys_1,
			DeviceKeys_2,
			DeviceKeys_3,
			DeviceKeys_4,
			DeviceKeys_5,
			DeviceKeys_6,
			DeviceKeys_7,
			DeviceKeys_8,
			DeviceKeys_9,
			DeviceKeys_Exc,		//!< !
			DeviceKeys_DQ,		//!< "
			DeviceKeys_No,		//!< #
			DeviceKeys_Dol,		//!< $
			DeviceKeys_Per,		//!< %
			DeviceKeys_Amp,		//!< &
			DeviceKeys_SQ,		//!< '
			DeviceKeys_LBln,	//!< (
			DeviceKeys_RBln,	//!< )
			DeviceKeys_Eq,		//!< =
			DeviceKeys_Min,		//!< -
			DeviceKeys_Cld,		//!< ~
			DeviceKeys_Hat,		//!< ^
			DeviceKeys_At,		//!< @
			DeviceKeys_Pip,		//!< |
			DeviceKeys_Sl,		//!< /
			DeviceKeys_BSl,		//!< \ 
			DeviceKeys_LBls,	//!< {
			DeviceKeys_RBls,	//!< }
			DeviceKeys_LBlk,	//!< [
			DeviceKeys_RBlk,	//!< ]
			DeviceKeys_Uber,	//!< _
			DeviceKeys_Pls,		//!< +
			DeviceKeys_Ast,		//!< *
			DeviceKeys_Cln,		//!< :
			DeviceKeys_SCln,	//!< ;
			DeviceKeys_Dot,		//!< .
			DeviceKeys_Cnm,		//!< ,
			DeviceKeys_Glt,		//!< >
			DeviceKeys_Les,		//!< <
			DeviceKeys_Qst,		//!< ?
			DeviceKeys_Bqt,		//!< `
			DeviceKeys_LShift,
			DeviceKeys_RShift,
			DeviceKeys_LAlt,
			DeviceKeys_RAlt,
			DeviceKeys_LCtl,
			DeviceKeys_RCtl,
			DeviceKeys_Arrow_Up,
			DeviceKeys_Arrow_Down,
			DeviceKeys_Arrow_Left,
			DeviceKeys_Arrow_Right,
			DeviceKeys_Caps,
			DeviceKeysNum
		};

		//! 上記キーの文字マップ
		/*! 文字としてタイプ不可能なものは0x0が割り付けられます
		*/
		extern const r_char DeviceKeysCharMap[];

		class DeviceKeys : public Device
		{
			RRTTI_REFLECTION_DECLARE
		public:
			DeviceKeys ( void );
			virtual ~DeviceKeys ( void );
		public:
			//! pushを取得
			/*!
			*/
			r_bool				getPushKey ( r_si32 keyID ) const;
			//! pressを取得
			/*!
			*/
			r_bool				getPressKey ( r_si32 keyID ) const;
			//! upを取得
			/*!
			*/
			r_bool				getReleaseKey ( r_si32 keyID ) const;
			//! repeatを取得
			/*!
			*/
			r_bool				getRepeatKey ( r_si32 keyID ) const;
		protected:
			r_ui32				keyCount[DeviceKeysNum];		//!< キー押下カウント
			r_si8				key[DeviceKeysNum];			//!< キー情報
		private:
		};
	}
}

#endif // _R_INPUT_DEVICE_KEYS_H_